<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">专营店基本信息</div>

  <!-- Table -->
  <table class="table table-condensed">
    <tbody>
      <tr>
        <td class="bg-primary col-md-1">所属区：</td>
        <td><?php echo $storeData['region'] ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">专营店：</td>
        <td><?php echo $storeData['storeName'] ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">年度额度：</td>
        <td><?php echo $procData['yearMoney'] ?></td>
      </tr>
    </tbody>
  </table>
</div>
<table class="table table-condensed table-bordered mb27">
    <thead class="text-center">
        <tr>
          <td class="bg-primary text-center" width="20%">类型</td>
          <td class="bg-primary text-center" width="20%">专营店名称</td>
          <td class="bg-primary text-center" width="30%">年度额度</td>
          <td class="bg-primary text-center" width="30%">申报金额</td>
        </tr>
      </thead>
    <tbody class="text-center" id="inputStoreList">
    <?php
    $yearTotalMoney = $applyTotalMoney = 0;
    ?>
    <?php foreach ($storeList as $k => $v): ?>
      <tr>
        <td><?=$v['storeId']==$procData['storeId'] ? '申报店' :'协办店'?></td>
        <td><?=$v['storeName']?></td>
        <td><?=$v['yearMoney']?></td>
        <td><?=$v['applyMoney']?></td>
      </tr>
      <?php
      $yearTotalMoney += $v['yearMoney'];
      $applyTotalMoney += $v['applyMoney'];
      ?>
    <?php endforeach ?>
    </tbody>
    <tbody class="text-center">
      <tr>
        <td colspan="2">总计:</td>
        <td><span class="yearTotalMoney"><?=$yearTotalMoney?></span></td>
        <td><span class="applyTotalMoney"><?=$applyTotalMoney?></span></td>
      </tr>
    </tbody>
  </table>


<table class="table table-condensed table-bordered mb27">
  <thead class="text-center">
      <tr>
        <td class="bg-primary text-center">投放编号</td>
        <td class="bg-primary text-center">投放类型</td>
        <td class="bg-primary text-center">投放规格</td>
        <td class="bg-primary text-center">地址</td>
        <td class="bg-primary text-center">合同时间</td>
        <td class="bg-primary text-center">合同附件</td>
        <td class="bg-primary text-center">发票附件</td>
        <td class="bg-primary text-center">会签审批表</td>
        <td class="bg-primary text-center">合同金额</td>
      </tr>
    </thead>
  <tbody class="text-center">
    <?php foreach ($projectList as $k => $v): ?>
    <tr>
      <td><?=$v['id']?></td>
      <td><?=$v['mediaTypeStr']?></td>
      <td><?=$v['mediaSize']?></td>
      <td><?=$v['address']?></td>
      <td><?=$v['contractStart']?>--<?=$v['contractEnd']?></td>
      <td>
        <?php if ($v['contractFile']): ?>
        <a type="button" class="btn btn-default" href="<?=printUrl('Upload','download',array('fileId'=>$v['contractFile']['id']))?>" aria-label="Left Align" role="button">
                <span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
                附件下载
              </a>
        <?php endif ?>
      </td>
      <td>
        <?php if ($v['invoiceFile']): ?>
        <a type="button" class="btn btn-default" href="<?=printUrl('Upload','download',array('fileId'=>$v['invoiceFile']['id']))?>" aria-label="Left Align" role="button">
                <span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
                附件下载
              </a>
        <?php endif ?>
      </td>
      <td>
        <a type="button" onclick="showJsonPhotos('<?=printUrl('SpreadBudget','storeProjectPhotos', array('projectId'=>$v['id']))?>')" class="btn btn-default" aria-label="Left Align" role="button">
                查看
              </a>
      </td>
      <td><?=$v['applyMoney']?></td>
    </tr>
    <?php endforeach ?>
  </tbody>
</table>

  <table class="table table-condensed mb27">
      <tbody>
        <tr>
          <td class="bg-primary col-md-1">申报金额：</td>
          <td><span class="applyTotalMoney"><?=$applyTotalMoney?></span></td>
        </tr>
        <tr>
          <td class="bg-primary col-md-1">合同金额：</td>
          <td><span class="projectApplyMoney"><?=$projectSumMoney?></span></td>
        </tr>
      </tbody>
    </table>
 <div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">审核结果
  </div>
  <table class="table table-condensed table-bordered mb27">
    <tbody>
      <tr>
        <td class="bg-primary col-md-1">审核进度</td>
        <td><?php echo $procData['auditRoleStr']; ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">审核结果</td>
        <td><?php echo $procData['auditRsStr']; ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-1">意见备注</td>
        <td><?php echo isset($auditData['auditDes']) ? $auditData['auditDes'] : '' ?></td>
      </tr>
    </tbody>
  </table>
</div>
<?php if ($auditList): ?>
<table class="table">
  <thead>
    <tr>
      <th class="bg-primary text-center">审核级别</th>
      <th class="bg-primary text-center">审核状态</th>
      <th class="bg-primary text-center">审核备注</th>
      <th class="bg-primary text-center">审核时间</th>
    </tr>
  </thead>
  <tbody>
  <?php foreach($auditList as $k => $v): ?>
    <tr>
      <td class="text-center"><?php echo $v['auditRoleStr']; ?></td>
      <td class="text-center"><?php echo $v['auditRsStr']; ?></td>
      <td class="text-center"><?php echo $v['auditDes']; ?></td>
      <td class="text-center"><?php echo date("Y-m-d H:i:s", $v['createTime']) ?></td>
    </tr>
  <?php endforeach; ?>
  </tbody>
</table>
<?php endif ?>
<form class="form-inline" name="audit" id="audit" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
<input type="hidden" name="procId" id="procId" value="<?=$procData['id']?>">
<input type="hidden" name="subtype" id="subtype" value="0">
<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">预算审核</div>

  <!-- Table -->
  <table class="table table-condensed">
    <tbody>
      <tr>
        <td class="bg-primary col-md-2">审核人：</td>
        <td><?php echo $this->user['userRoleName'] ?></td>
      </tr>
      <tr>
        <td class="bg-primary col-md-2">审核结果：</td>
        <td>
        <?php
        $options = $this->config->item('spreadBudgetAuditOptions');
        $extra = '';
        echo form_dropdown('audit[auditRs]', $options, 0, $extra);
        ?>
        </td>
      </tr>
      <tr>
        <td class="bg-primary col-md-2">意见备注：</td>
        <td><textarea style="width: 500px; height: 100px;" class="form-control" rows="3" name="audit[auditDes]" placeholder="审核意见"></textarea></td>
      </tr>
      <tr>
        <td class="text-center" colspan="2">
          <button class="btn btn-default btn-danger" type="button" onclick="$('#subtype').val(0);ajaxFormSubmit('audit')">提交</button>
          <button class="btn btn-default btn-danger" style="width:200px;" type="button" onclick="$('#subtype').val(1);ajaxFormSubmit('audit')">提交并审核下一家专营店</button>
          <button class="btn btn-default btn-primary" type="button" onclick="window.location.href='<?=$breadcrumb[count($breadcrumb)-2]['url']?>'" role="button">返回</button>
        </td>
      </tr>
    </tbody>
  </table>
</div>
</form>
<?php $this->load->view('common/foot');?>